from factory import Factory;

class Message:
	def __init__(self, body = None, user = None):
		self.body = body;
		self.user = user;

class Bot:
	def __init__(self, config):
		try:
			self.log       = Factory('log',       config.items('log'));
#			elf.transport = Factory('transport', config.items('transport'));
#			self.storage   = Factory('storage',   config.items('storage'));
			self.commands  = [];
		except Exception, e:
			import traceback
			traceback.print_exc(e)
			print e.message;

	def talk(self, message):
		self.transport.talk(message);

	def receive(self, message):
		for command in self.commands:
			if self.command.likes(message):
				self.command.execute(message);
